package com.evan.common.controller;

import com.evan.common.bit.RoleType;
import com.evan.common.pojo.Roles;
import com.evan.common.service.RoleService;
import com.evan.common.service.impl.RolesServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.persistence.Convert;
import java.util.List;

/**
 * @description:
 * @author: xiaohu
 * @createDate: 2021/7/20 22:19
 */
@RestController
@RequestMapping("/role")
@Api("Role -- 角色接口")
public class RoleController {
    @Autowired
    RoleService rs = new RolesServiceImpl();

    @GetMapping("/all")
    @ApiOperation("查找所有角色")
    public List<Roles> getAllRoles(){
        return rs.getAllRoles();
    }

    @PostMapping("/add")
    @ApiOperation("添加角色")
    public List<Roles> addRole(Roles role){
        rs.addRole(role);
        return rs.getAllRoles();
    }

}
